#ifndef MYSERIALPORT_H
#define MYSERIALPORT_H

#include <QObject>
#include <QSerialPort>
#include <QSerialPortInfo>
class MySerialPort : public QObject
{
    Q_OBJECT
public:
    explicit MySerialPort(QObject *parent = nullptr);
    ~MySerialPort();

    Q_INVOKABLE bool serialConnect(QString port);
    Q_INVOKABLE QString serialRead();
    Q_INVOKABLE bool serialWrite(QString sendStr);
    Q_INVOKABLE bool isOpen();
    Q_INVOKABLE QString getSerialInfo();
    Q_INVOKABLE void serialClose();

signals:
    void sendSerialInfo(QString info);
public slots:
private:
    QSerialPort *m_serial;

};

#endif // MYSERIALPORT_H
